package com.fr.report;

import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLReadable;
import com.fr.base.xml.XMLableReader;
import com.fr.data.TableData;
import com.fr.report.io.xml.SynchronizedReportSettings;
import java.util.ArrayList;
import java.util.List;

public abstract class AbstractTemplateWorkBook extends AbstractFineBook
  implements TemplateWorkBook
{
  protected ReportParameterAttr reportParameterAttr = null;

  public void addReport(TemplateReport paramTemplateReport)
  {
    super.addReport(null, paramTemplateReport);
  }

  public void addReport(String paramString, TemplateReport paramTemplateReport)
  {
    super.addReport(getReportCount(), paramString, paramTemplateReport);
  }

  public void setReport(int paramInt, TemplateReport paramTemplateReport)
  {
    super.setReport(paramInt, paramTemplateReport);
  }

  public void setReport(int paramInt, String paramString, TemplateReport paramTemplateReport)
  {
    super.setReport(paramInt, paramString, paramTemplateReport);
  }

  public TemplateReport getTemplateReport(int paramInt)
  {
    return ((TemplateReport)super.getReport(paramInt));
  }

  public int getReportIndex(TemplateReport paramTemplateReport)
  {
    return super.getReportIndex(paramTemplateReport);
  }

  protected void setWorkBook(Report paramReport, FineBook paramFineBook)
  {
    ((TemplateReport)paramReport).setTemplateWorkBook((TemplateWorkBook)paramFineBook);
  }

  public ReportParameterAttr getReportParameterAttr()
  {
    return this.reportParameterAttr;
  }

  public void setReportParameterAttr(ReportParameterAttr paramReportParameterAttr)
  {
    this.reportParameterAttr = paramReportParameterAttr;
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    AbstractTemplateWorkBook localAbstractTemplateWorkBook = (AbstractTemplateWorkBook)super.clone();
    ArrayList localArrayList1 = new ArrayList();
    localArrayList1.addAll(this.tableDataNameList);
    localAbstractTemplateWorkBook.tableDataNameList = localArrayList1;
    ArrayList localArrayList2 = new ArrayList();
    for (int i = 0; i < this.tableDataList.size(); ++i)
      localArrayList2.add(((TableData)this.tableDataList.get(i)).clone());
    localAbstractTemplateWorkBook.tableDataList = localArrayList2;
    if (getReportParameterAttr() != null)
      localAbstractTemplateWorkBook.setReportParameterAttr((ReportParameterAttr)getReportParameterAttr().clone());
    return localAbstractTemplateWorkBook;
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    super.writeXML(paramXMLPrintWriter);
    ReportParameterAttr localReportParameterAttr = getReportParameterAttr();
    if (localReportParameterAttr != null)
    {
      paramXMLPrintWriter.startTAG("ReportParameterAttr");
      localReportParameterAttr.writeXML(paramXMLPrintWriter);
      paramXMLPrintWriter.end();
    }
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    super.readXML(paramXMLableReader);
    if (paramXMLableReader.isChildNode())
    {
      Object localObject;
      String str = paramXMLableReader.getTagName();
      if ("ReportParameterAttr".equals(str))
      {
        localObject = getReportParameterAttr();
        if (localObject == null)
        {
          localObject = new ReportParameterAttr();
          setReportParameterAttr((ReportParameterAttr)localObject);
        }
        paramXMLableReader.readXMLObject((XMLReadable)localObject);
      }
      else if (("ReportSettings".equals(str)) || ("ReportSetting".equals(str)))
      {
        localObject = new ReportSettings();
        paramXMLableReader.readXMLObject((XMLReadable)localObject);
        SynchronizedReportSettings.putSynchronizedReportSettings(this, (ReportSettings)localObject);
      }
    }
  }
}